<template>
  <div>
    <div class="xzf-model" @click="handleClose"></div>
    <div class="xzf-dialog">
      <div class="title">
        <!--<div class="operation">
          <i class="el-icon-zoom-in" @click="handleZoom('big')"></i>
          <i class="el-icon-zoom-out" @click="handleZoom('small')"></i>
          <i class="el-icon-refresh-right" @click="rotate"></i>
        </div>-->
        <div></div>
        <i class="el-icon-close" @click="handleClose"></i>
      </div>
      <div class="xzf-dialog-body">
        <cropper-template :imgUrl="dialogImageUrl"></cropper-template>
      </div>
    </div>
  </div>
</template>

<script>
import CropperTemplate from '../cropperTemplate/cropperTemplate'
export default {
  name: 'xzfDialog',
  components: { CropperTemplate },
  props: {
    dialogImageUrl: {
      type: String
    }
  },
  data () {
    return {
    }
  },
  methods: {

    handleClose () {
      this.$emit('xzfClose', false)
    }
  }
}
</script>

<style lang="scss" scoped>
  .xzf-model {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2021;
    background: rgba(0, 0, 0, 0.5);
  }

  .xzf-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 2022;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 5px;
    box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);

    .title {
      height: 40px;
      font-weight: bolder;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 20px;
      position: relative;
      z-index: 10;

      .operation {
        font-size: 20px;

        i {
          cursor: pointer;

          &:hover {
            opacity: 0.8;
          }

          & + i {
            margin-left: 10px;
          }
        }
      }

      .el-icon-close {
        cursor: pointer;
        font-size: 20px;

        &:hover {
          opacity: 0.8;
        }
      }
    }

    .xzf-dialog-body {
      padding: 20px;
      height: calc(100vh - 100px);
      width: calc(100vw - 100px);
      position: relative;
      overflow-x: hidden;
      overflow-y: auto;

      img {
        width: 100%;
        position: absolute;
        top: 0;
        left: 0;
        transition: 0.4s linear;
      }
    }
  }
</style>
